package com.skp.shaphan.ui.results;

import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;

import com.skp.shaphan.sql.ValueToText;

public class Row extends HashMap<String, String> {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -8179368171629101704L;

	public Row(ResultSet rs, int fieldCount, int rownum) {
		this.put("rownum", Integer.toString(rownum));
		for(int x=1; x<=fieldCount; x++) {
			try {
				this.put("col" + x, ValueToText.getInstance().convert(rs.getObject(x)));
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
